package com.stm.toolLedger.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.stm.common.annotation.DataScope;
import com.stm.toolLedger.domain.ToolsBoxDetail;
import com.stm.toolLedger.mapper.ToolsBoxDetailMapper;
import com.stm.toolLedger.service.ToolsBoxDetailService;

/**
 * 
 * @Description 库房详情impl
 * @CreateTime 2019年4月4日 上午8:43:59
 * @CreateBy 林龙
 */
@Service
public class ToolsBoxDetailServiceImpl implements ToolsBoxDetailService
{
    @Autowired
    private ToolsBoxDetailMapper toolsBoxDetailMapper;

    /**
	 * 
	 * @Description 获取库存详情湿度数据
	 * @CreateTime 2019年4月17日 上午10:21:54
	 * @CreateBy 林龙
	 * @param toolsBoxDetail
	 * @return
	 */
	@Override
	public List<Map<String, Object>> queryList(ToolsBoxDetail toolsBoxDetail) {
		List<Map<String,Object>> resultList = new ArrayList<Map<String,Object>>();	
		List<ToolsBoxDetail> list1 = toolsBoxDetailMapper.selectAllPageList(toolsBoxDetail);
		
		for (ToolsBoxDetail toolsBoxDetail1 : list1) {
			Map<String,Object> resultMap = new HashMap<String,Object>();// 返回值
			
			
			resultMap.put("currentTime", toolsBoxDetail1.getCurrdatatime());
			resultMap.put("depotouth", toolsBoxDetail1.getDepotouth());
			resultMap.put("depotinh", toolsBoxDetail1.getDepotinh());
			resultMap.put("depotid", toolsBoxDetail1.getBoxName());
			resultList.add(resultMap);
		}
		
		return resultList;
	}

	/**
	 * 
	 * @Description  获取库房详情温度数据
	 * @CreateTime 2019年4月17日 下午3:18:48
	 * @CreateBy 林龙
	 * @param toolsBoxDetail
	 * @return
	 */
	@Override
	public List<Map<String, Object>> queryTemperatureList(ToolsBoxDetail toolsBoxDetail) {
		List<Map<String,Object>> resultList = new ArrayList<Map<String,Object>>();	
		List<ToolsBoxDetail> list1 = toolsBoxDetailMapper.selectAllPageList(toolsBoxDetail);
		
		for (ToolsBoxDetail toolsBoxDetail1 : list1) {
			Map<String,Object> resultMap = new HashMap<String,Object>();// 返回值
			
			resultMap.put("currentTime", toolsBoxDetail1.getCurrdatatime());
			resultMap.put("depotoutt", toolsBoxDetail1.getDepotoutt());
			resultMap.put("depotint", toolsBoxDetail1.getDepotint());
			resultMap.put("depotid", toolsBoxDetail1.getBoxName());
			resultList.add(resultMap);
		}
		
		return resultList;
	}

	/**
	 * 
	 * @Description 获取最近温度，湿度，时间
	 * @CreateTime 2019年4月28日 下午3:56:38
	 * @CreateBy 林龙
	 * @return
	 */
	@Override
	@DataScope(tableAlias = "b2")
	public ToolsBoxDetail selectByData(ToolsBoxDetail toolsBoxDetail) {
		
		return toolsBoxDetailMapper.selectByData(toolsBoxDetail);
	}

	

	
	
	
   
}
